package com.example.demo.information.entity.info;

import com.example.demo.information.entity.Bjxx;
import com.example.demo.information.entity.School;
import com.example.demo.information.entity.Student;
import lombok.Data;

@Data
public class StudentInfo {
    private Long xsId;
    private String name;
    private String sfz;
    private String xjfh;
    private String sex;
    private String bjmc;
    private String xxmc;
    private Long bjxxId;
    private Long xxxxId;
    private Long address;
    private String addressUrl;
    private String addressStr;
    private String ytAddressUrl;
    private String ytAddressStr;
    private String width;
    private String height;
    private Integer urlTime;

    public StudentInfo(){
        super();
    }

    public StudentInfo(Student student){
        this.xsId = student.getId();
        this.name = student.getName();
        this.sfz = student.getSfz();
        this.xjfh = student.getXjfh();
        this.sex = student.getSex();
        if(student.getBjxx()!=null){
            this.bjmc = student.getBjxx().getName();
            this.bjxxId = student.getBjxx().getId();
        }
        if(student.getSchool()!=null){
            this.xxmc = student.getSchool().getName();
            this.xxxxId = student.getSchool().getId();
        }
    }

    public StudentInfo(Student student, Bjxx bjxx, School school){
        this.xsId = student.getId();
        this.name = student.getName();
        this.sfz = student.getSfz();
        this.xjfh = student.getXjfh();
        this.sex = student.getSex();
        if(bjxx!=null){
            this.bjmc = bjxx.getName();
            this.bjxxId = bjxx.getId();
        }
        if(school!=null){
            this.xxmc = school.getName();
            this.xxxxId = school.getId();
        }
    }

    public String toString(){
        return this.name+","
                +this.sfz+","
                +this.xjfh+","
                +this.sex+","
                +this.bjmc+","
                +this.bjxxId+","
                +this.xxxxId;
    }
}
